#!/usr/bin/env python
# -*- encoding: utf-8 -*-
'''
@File    :   custom_exc.py
@Time    :   2021/02/06 18:23:51
@Author  :   superjin
@Version :   1.0
'''

from fastapi import Header, Depends, Request, HTTPException, status


class TokenAuthError(HTTPException):
    def __init__(self, err_desc: str = "Auth Token error"):
        self.status_code = status.HTTP_401_UNAUTHORIZED
        self.detail = err_desc
        self.headers = {"WWW-Authenticate": "Bearer"}


class MissingAuthTokenError(HTTPException):
    def __init__(self, err_desc: str = "Missing Auth Token"):
        self.status_code = status.HTTP_401_UNAUTHORIZED
        self.detail = err_desc
        self.headers = {"WWW-Authenticate": "Bearer"}


class TokenExpired(HTTPException):
    def __init__(self, err_desc: str = "Token has expired"):
        self.status_code = status.HTTP_401_UNAUTHORIZED
        self.detail = err_desc
        self.headers = {"WWW-Authenticate": "Bearer"}


class AuthenticationError(HTTPException):
    def __init__(self, err_desc: str = "Permission denied"):
        self.status_code = status.HTTP_401_UNAUTHORIZED
        self.detail = err_desc
        self.headers = {"WWW-Authenticate": "Bearer"}


class UserNotFoundError(HTTPException):
    def __init__(self, err_desc: str = "User not found"):
        self.err_desc = err_desc
        self.detail = err_desc

class DataBasedError(HTTPException):
    def __init__(self, err_desc: str = "Database error"):
        self.status_code = status.HTTP_200_OK
        self.err_desc = err_desc
        self.detail = err_desc
        
class GeneralError(HTTPException):
    def __init__(self, err_desc: str = "Database error"):
        self.status_code = status.HTTP_200_OK
        self.err_desc = err_desc
        self.detail = err_desc

